summaryrefslogtreecommitdiff
path: root/frontend/app/drive/[...path]
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-08-13 14:02:35 +0100
committerdiogo464 <[email protected]>2025-08-13 14:02:35 +0100
commit86c0a412d2ed3fb22735e373d951e50ee24cdacd (patch)
tree348472edcedf8cd0f8685da06dbca20a094f1c08 /frontend/app/drive/[...path]
parent80b66131b793c7d3b9a5df9168906e29e296a057 (diff)
Fix SSR storage data fetching in drive pages
- Replace HTTP fetch with direct function import - Remove environment-dependent URL construction - Fix 'Failed to parse URL from /api/storage' error in production - Import fetchStorageData directly from lib/storage - Enable static rendering for /drive page 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Diffstat (limited to 'frontend/app/drive/[...path]')
-rw-r--r--frontend/app/drive/[...path]/page.tsx22
1 files changed, 1 insertions, 21 deletions
diff --git a/frontend/app/drive/[...path]/page.tsx b/frontend/app/drive/[...path]/page.tsx
index bfb65ad..69db5c4 100644
--- a/frontend/app/drive/[...path]/page.tsx
+++ b/frontend/app/drive/[...path]/page.tsx
@@ -1,26 +1,6 @@
1import { DriveDirectoryView } from "@/components/drive/DriveDirectoryView" 1import { DriveDirectoryView } from "@/components/drive/DriveDirectoryView"
2import { Drive_ls } from "@/lib/drive_server" 2import { Drive_ls } from "@/lib/drive_server"
3 3import { fetchStorageData } from "@/lib/storage"
4async function fetchStorageData() {
5 try {
6 const response = await fetch(`${process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:3000' : ''}/api/storage`, {
7 cache: 'no-store'
8 })
9 if (!response.ok) {
10 throw new Error('Failed to fetch storage data')
11 }
12 return await response.json()
13 } catch (error) {
14 console.error('Failed to fetch storage data:', error)
15 // Return zeros on error as requested
16 return {
17 activeDriveUsage: 0,
18 totalDiskCapacity: 0,
19 totalDiskUsed: 0,
20 availableDisk: 0
21 }
22 }
23}
24 4
25export default async function DriveDirectoryPage({ 5export default async function DriveDirectoryPage({
26 params, 6 params,